package com.tyk.bookstore.front.auth.strategy.enume;

import com.fasterxml.jackson.annotation.JsonValue;
import com.tyk.bookstore.front.auth.strategy.LoginAction;
import com.tyk.bookstore.front.auth.strategy.impl.*;
import com.tyk.bookstore.front.common.core.model.enume.BaseEnum;

/**
 * @author tyk
 * @description LoginCodeType
 */
public enum LoginType implements BaseEnum {

    ACCOUNT_PASSWORD(0, AccountPwdLoginAction.class),
    PHONE_PASSWORD(1, PhonePwdLoginAction.class),
    PHONE_CODE(2, PhoneCodeLoginAction.class),
    EMAIL_PASSWORD(3, EmailPwdLoginAction.class),
    EMAIL_CODE(4, EmailCodeLoginAction.class);

    @JsonValue
    private final Integer code;

    LoginType(Integer code, Class<? extends LoginAction<?>> clazz) {
        this.code = code;
        this.clazz = clazz;
    }

    @Override
    public Integer value() {
        return this.code;
    }

    private final Class<? extends LoginAction<?>> clazz;

    public String getClassName() {
        return this.clazz.getSimpleName();
    }

}
